package com.common.util;

import java.io.File;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.system.ApplicationHome;


public class EnvironmentUtil {

	protected static Logger logger = LoggerFactory.getLogger(EnvironmentUtil.class);
	
	private static Boolean isDevEnvi=null;
	
    private EnvironmentUtil() {

    }
	
    /**
     * 是否开发环境
     * @return
     */
    public static boolean isDevEnvi() {
    	if(isDevEnvi==null) {
    		ApplicationHome h2 = new ApplicationHome();
            File sourceFile=h2.getSource();
            if(sourceFile==null) {
            	// 区分开发环境和发布环境 
            	isDevEnvi=true;
            }else {
            	isDevEnvi=false;
            }
    	}
        return isDevEnvi;
    }
}
